<!DOCTYPE html>
<html lang="zh-CN">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>商城抢购页面</title>
<style>
/* 全局样式 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
}

/* 页面容器 */
.container {
width: 1200px;
margin: 0 auto;
padding: 20px;
}

/* 头部盒子 */
.header {
background-color: #333;
color: white;
text-align: center;
padding: 20px;
margin-bottom: 20px;
}

/* 商品展示盒子 */
.product {
background-color: white;
border: 1px solid #ccc;
border-radius: 5px;
padding: 20px;
margin-bottom: 20px;
display: flex;
}

.product img {
width: 200px;
height: 200px;
object-fit: cover;
margin-right: 20px;
}

.product-info {
flex: 1;
}

.product-title {
font-size: 24px;
margin-bottom: 10px;
}

.product-price {
color: red;
font-size: 20px;
margin-bottom: 10px;
}

/* 倒计时盒子 */
.countdown {
font-size: 20px;
margin-bottom: 10px;
}

/* 按钮盒子 */
.btn {
display: inline-block;
background-color: #007BFF;
color: white;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
}
</style>
</head>

<body>
<div class="container">
<div class="header">
<h1>限时抢购</h1>
</div>
<div class="product">
<img src="8e39fb4f8ef8e53b.png" alt="商品图片">
<div class="product-info">
<h2 class="product-title">OPPO Reno13</h2>
<p class="product-price">$99.99</p >
<div class="countdown">倒计时：<span id="countdown-time"></span></div>
<button class="btn">立即抢购</button>
</div>
</div>
<script>
// 倒计时函数
function countdown() {
const targetDate = new Date('2024-01-01T00:00:00').getTime();
const now = new Date().getTime();
const distance = targetDate - now;

const days = Math.floor(distance / (1000 * 60 * 60 * 24));
const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((distance % (1000 * 60)) / 1000);

document.getElementById('countdown-time').innerHTML = `${days}天 ${hours}小时 ${minutes}分钟 ${seconds}秒`;

if (distance < 0) {
clearInterval(countdownInterval);
document.getElementById('countdown-time').innerHTML = '抢购已结束';
}
}

const countdownInterval = setInterval(countdown, 1000);
</script>
</div>
</body>

</html>